package com.lagou.edu.dao;

import com.lagou.edu.entity.UserAuthCode;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * @date 2020/5/26 12:31
 */
public interface LagouAuthCodeDao extends JpaRepository<UserAuthCode,Long> {

    /**
     * 根据emial和code查询邮箱验证码，并按照过期时间倒序
     * @param email
     * @param code
     * @return
     */
    List<UserAuthCode> findLagouAuthCodeByEmailAndCodeOrderByExpiretimeDesc(String email, String code);

    /**
     * 根据email查询邮箱验证码等信息，并按照过期时间倒序
     * @param email
     * @return
     */
    List<UserAuthCode> findLagouAuthCodeByEmailOrderByExpiretimeDesc(String email);


}
